﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="InvestmentReturn.aspx.cs"
    Inherits="Rep_InvestmentReturn" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>投退时间查询</title>
    <link href="../css/SIS.css" rel="stylesheet" type="text/css" />

    <script language="javascript" type="text/javascript" src="../My97DatePicker/WdatePicker.js"></script>

    <script language="javascript" type="text/javascript" src="../Js/Excel.js"></script>

    <script src="../Js/jquery-1.6.2.js" type="text/javascript"></script>

    <script src="../WPS/Letter.js" type="text/javascript"></script>

    <script src="../WPS/Hour.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript">
        var count=3;
        $(document).ready(function(){ 
            getsDate();
            geteDate();
            $("#divWait").show();
            load();
            $("#divWait").hide();
            $("#btnSearch").click(function() {
               $("#divWait").show();
               $("#dvShow").hide();
               var sId=$("#point").val();
               if(sId!=null&&sId!=''){ 
                   $.post("InvestmentReturn.aspx", { param: 'query',id:sId,sTime: $("#txtsDate").val(),eTime: $("#txteDate").val()}, function (data) {
                       count = data.count;
                       $("#dvShow").html(data.tableInfo);
                       $("#dvShow").show();
                       $("#divWait").hide();
                   }, 'json');
               }
            });
            
           $("#btnWPS").click(function() {           
                AutomateWPS(CX,3,count,'投退时间纪录');
            });              
            
            $("#btnExcel").click(function() {           
                toExcel(CX);
            }); 
        });
                

        function load(){
            $("#divWait").show();
            $.post("InvestmentReturn.aspx", { param: '',id:'0',sTime: $("#txtsDate").val(),eTime: $("#txteDate").val()}, function (data) {                
                var list = data.list;                
                $("#point").empty();
                $("#point").append("<option value='0'>全部</option>");
                for(var i=0;i<list.length;i++){
                    $("#point").append("<option value='"+list[i].ID+"'>"+list[i].NAME+"</option>");
                }
                var strApp = data.tableInfo;  
                count = data.count;              
                $("#dvShow").html(strApp);
                $("#divWait").hide();
            }, 'json');
        }
        
       function geteDate(){
            var myDate = new Date();
            var date;
            date = myDate.getYear()+'-'+(myDate.getMonth()+1)+'-'+(myDate.getDate()); 
            $("#txteDate").val(date);
        }
        
        function getsDate(){
            var myDate = new Date();
            var date;
            var day = myDate.getDate();
            if(myDate.getMonth()==0&&day==1){
                 (date = myDate.getYear()-1)+'-12-30';  
            }else
            {
                if(day>1){
                    date = myDate.getYear()+'-'+(myDate.getMonth()+1)+'-'+(day-1); 
                }else
                {
                    if(month==1||month==3||month==5||month==7||month==8||month==10){               
                        day = 31;   
                    }else if(month==4||month==6||month==9||month==11){
                        day = 30;
                    }else{
                        if(myDate.getYear%4==0){
                            day = 29;  
                        }else{
                            day = 28;  
                        }
                    }
                    date = myDate.getYear()+'-'+(myDate.getMonth()+1)+'-'+(day); 
                }
            }
            $("#txtsDate").val(date);
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div id="Div1">
        <img src="../img/tt.jpg" width="100%" />
    </div>
    <table style="width: 90%; left: 200px;">
        <tr>
            <td align="left" valign="middle">
                &nbsp; &nbsp; 查询设备:&nbsp;
                <select id="point" runat="server">
                </select>
                &nbsp; &nbsp
                <label id="lalStime" style="height: 30px;" runat="server">
                    开始时间:</label>
                <input type="text" id="txtsDate" style="text-align: center;" runat="server" readonly="readonly"
                    onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})" />
                &nbsp; &nbsp;
                <label id="Label1" style="height: 30px;" runat="server">
                    结束时间:</label>
                <input type="text" id="txteDate" style="text-align: center;" runat="server" readonly="readonly"
                    onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})" />
                &nbsp; &nbsp; &nbsp;
                <input id="btnSearch" type="button" value=" 查 询" style="height: 22px" class="nvinput" />
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                <input id="btnExcel" type="button" style="height: 22px" value="导出Excel" class="nvinput" />
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                <input id="btnWPS" type="button" style="height: 22px" value="导出WPS" class="nvinput" />
            </td>
        </tr>
    </table>
    <div id="divWait">
        <img id="loadImg" src="../img/loading.gif" />
    </div>
    <div id="dvShow">
    </div>
    <div id="dvLoad" runat="server">
    </div>
    </form>
</body>
</html>
